package com.turing.post.account.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 应用签约银行关联表
 * 
 * @author zxp
 * @Apr 9, 2013
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "BankAssoc")
@IdClass(BankAssoc.class)
public class BankAssoc implements Serializable {

	private BigInteger bankManageId;// 银行管理ID
	private BigInteger masterAccNo;// 主账号
	private String accNo;// 银行账号

	public BankAssoc() {

	}

	@Id
	@Column(name = "bankManageId")
	public BigInteger getBankManageId() {
		return bankManageId;
	}

	public void setBankManageId(BigInteger bankManageId) {
		this.bankManageId = bankManageId;
	}

	@Id
	@Column(name = "masterAccNo")
	public BigInteger getMasterAccNo() {
		return masterAccNo;
	}

	public void setMasterAccNo(BigInteger masterAccNo) {
		this.masterAccNo = masterAccNo;
	}

	@Id
	@Column(name = "accNo")
	public String getAccNo() {
		return accNo;
	}

	public void setAccNo(String accNo) {
		this.accNo = accNo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getAccNo() == null) ? 0 : getAccNo().hashCode());
		result = prime
				* result
				+ ((getBankManageId() == null) ? 0 : getBankManageId()
						.hashCode());
		result = prime
				* result
				+ ((getMasterAccNo() == null) ? 0 : getMasterAccNo().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final BankAssoc other = (BankAssoc) obj;
		if (getAccNo() == null) {
			if (other.getAccNo() != null)
				return false;
		} else if (!getAccNo().equals(other.getAccNo()))
			return false;
		if (getBankManageId() == null) {
			if (other.getBankManageId() != null)
				return false;
		} else if (!getBankManageId().equals(other.getBankManageId()))
			return false;
		if (getMasterAccNo() == null) {
			if (other.getMasterAccNo() != null)
				return false;
		} else if (!getMasterAccNo().equals(other.getMasterAccNo()))
			return false;
		return true;
	}

}
